package com.sf.eos.cx.user.api.controller;

import com.sf.eos.cx.skeleon.domain.UserInfo;
import com.sf.eos.cx.skeleon.service.user.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController implements IUserService {

    @GetMapping("hello/{name}")
    public String hello(@PathVariable("name")String name){
        return "Hello，" + name;
    }

    @Override
    @RequestMapping("/getUserInfo")
    public UserInfo getUserInfo() {
        log.error("12313123213123");
        UserInfo userInfo = new UserInfo();
        userInfo.setId(RandomUtils.nextLong());
        userInfo.setName(RandomStringUtils.randomAlphabetic(6));
        userInfo.setAddress(RandomStringUtils.randomAlphanumeric(20));
        userInfo.setAge(RandomUtils.nextInt(40));
        return userInfo;
    }
}
